from haystack import indexes
from goods.models import SKU

# SKU索引类
class SKUIndex(indexes.SearchIndex,indexes.Indexable):
    text = indexes.CharField(document=True,use_template=True)

    # 对那个模型类进行搜索
    def get_model(self):
        return SKU

    # 对下架商品进行过滤
    def index_queryset(self, using=None):
        return self.get_model().objects.filter(is_launched=True)
